Skip to content

Conversation

reuk
Copy link
Contributor

@reuk reuk commented Nov 22, 2017

After calling mutate() on an expr_iterator, a new state struct is created, containing iterators over the operands of a new expr created by copy-on-write behaviour. When this struct is compared for equality with the current struct at the back of the stack, iterators from two different collections are compared, which is undefined behaviour.

This patch changes the equality comparison to check the size of the iterator range in each state struct, rather than comparing iterators directly. This way, there's no danger of comparing iterators from different collections.

This bug was found by enabling -D_GLIBCXX_DEBUG. I suggest that this debug mode is added to Travis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants